package com.yanyu.space.member.feign.fallback;

import com.yanyu.space.common.core.bean.web.R;
import com.yanyu.space.member.bean.bo.StudentBo;
import com.yanyu.space.member.feign.IMemberClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

@Slf4j
public class MemberClientFallbackFactory implements FallbackFactory<IMemberClient> {

    @Override
    public IMemberClient create(Throwable cause) {
        return new IMemberClient() {
            @Override
            public R<String> testRequestParam(String param) {
                log.error("{}", cause);
                return R.fail();
            }

            @Override
            public R<String> testRequestBody(StudentBo bo) {
                log.error("{}", cause);
                return R.fail();
            }

            @Override
            public R<String> testThrowFallbackFactory1(String param) {
                log.error("{}", cause);
                return R.fail();
            }

            @Override
            public R<String> testThrowFallbackFactory2(String param) {
                log.error("{}", cause);
                return R.fail();
            }

        };
    }
}
